package com.cskaoyan.wxcontroller;

import com.cskaoyan.bean.baseresultVO.BaseRespVo;
import com.cskaoyan.bean.domain.Category;
import com.cskaoyan.bean.wxcatalogs.WxCatalog.CatalogIndexVo;
import com.cskaoyan.service.WxCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author looper
 * @ 类目控制器
 **/

@RestController
@RequestMapping("wx/catalog")
public class WxCatalogController {

    @Autowired
    WxCatalogService service;

    @GetMapping("index")
    public BaseRespVo getIndex() {

        CatalogIndexVo catalogIndexVo = service.getIndex();

        return BaseRespVo.ok(catalogIndexVo);
    }

    @GetMapping("current")
    public BaseRespVo getCurrent(Category category) {

        CatalogIndexVo catalogCurrent = service.getCurrent(category.getId());
        return BaseRespVo.ok(catalogCurrent);
    }

}
